using UnityEngine;

namespace Demo
{
    public class InExample
    {
        private int score = 0;
     
        void Start()
        {
            Debug.Log("==========InExample=========");
            Debug.Log("原始值:"+score);
            ChangeValue(score);
            Debug.Log("形参传递后:"+score);
            
            ReadValue(in score);
            Debug.Log("In修饰形参只能读取不能修改:"+score);
            Debug.Log("==========InExample==========");
        }

        void ChangeValue(int value)
        {
            value = 10;
        }

        void ReadValue(in int value)
        {
            var a = value;
        }
    }
}